﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace CiStatus.CiStatusAddIn.Views.ToolsOptionsViews
{
    public partial class AddSettingForm : Form
    {
        public KeyValuePair<string,string> Pair { get; set; }

        public AddSettingForm(KeyValuePair<string, string> pair)
        {
            InitializeComponent();
            tbKey.Text = pair.Key;
            tbValue.Text = pair.Value;
        }

        public AddSettingForm(string key)
        {
            InitializeComponent();
            tbKey.Text = key;
        }

        public AddSettingForm()
        {
            InitializeComponent();
        }

        private void AddKeyValueFormClosed(object sender, FormClosedEventArgs e)
        {
            Pair = new KeyValuePair<string, string>(tbKey.Text.Trim(),tbValue.Text.Trim());
        }

        public void SetKeyReadOnly()
        {
            tbKey.ReadOnly = true;
        }

        private void AddSettingForm_Load(object sender, EventArgs e)
        {
            tbValue.Select();
        }
    }
}
